package com.dqv5.demo.eureka.client.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author duqian
 * @date 2018/3/8
 */
@RestController
public class CustomerController {
    @Autowired
    @LoadBalanced
    protected RestTemplate restTemplate;

    @RequestMapping(value = "/customer")
    public Object provider() {
        String url = "http://EUREKA-CLIENT-PROVIDER/provider";
        Object obj = restTemplate.getForEntity(url, Object.class).getBody();
        return obj;
    }
}
